<?php

 namespace common\Factory;
 
 use common\Factory\FactoryInterface;
 
 class Factory implements FactoryInterface {
     
     private static $_server;
     
     public static function getServer($serverName) {
         $createCactory = false;
         !isset(self::$_server[$serverName]) ? $createCactory = true : (is_null(self::$_server[$serverName]) && $createCactory = true);
         
         if($createCactory) {
             $namespace = '\\'. __NAMESPACE__ .'\\'. $serverName .'\\'. $serverName . 'Server';
             $obj = new $namespace();
             self::$_server[$serverName] = $obj->getObj();
         }
         
         return self::$_server[$serverName];
     }
 }
 